package exception;

public class TryCatchDemo {
    public static void main(String[] args) {
        System.out.println("程序开始了");
        try{
//            String name=null;
//            System.out.println(name.length());
            String line1="";
            System.out.println(line1.charAt(0));
            String line2="abc";
            System.out.println(Integer.parseInt(line2));
        }catch (NullPointerException e){
            System.out.println("程序解决了");
        }catch(StringIndexOutOfBoundsException e){
            System.out.println("字符下标越界");
        }catch (Exception e){
            System.out.println("反正有异常");
        }

        System.out.println("程序结束了");
    }
}
